home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qpalette.h.z / qpalette.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.5 KB  |  118 lines

  1. /****************************************************************************
  2. ** $Id: qpalette.h,v 2.15 1998/07/03 00:09:36 hanord Exp $
  3. **
  4. ** Definition of QColorGroup and QPalette classes
  5. **
  6. ** Created : 950323
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QPALETTE_H
  25. #define QPALETTE_H
  26.  
  27. #ifndef QT_H
  28. #include "qwindowdefs.h"
  29. #include "qcolor.h"
  30. #include "qshared.h"
  31. #endif // QT_H
  32.  
  33.  
  34. class QColorGroup                // color group class
  35. {
  36. public:
  37.     QColorGroup();                // all colors black
  38.     QColorGroup( const QColor &foreground, const QColor &background,
  39.          const QColor &light, const QColor &dark, const QColor &mid,
  40.          const QColor &text, const QColor &base);
  41.    ~QColorGroup();
  42.  
  43.     const QColor &foreground()    const    { return fg_col; }
  44.     const QColor &background()    const    { return bg_col; }
  45.     const QColor &light()    const    { return light_col; }
  46.           QColor midlight()    const    { return bg_col.light( 115 ); }
  47.     const QColor &dark()    const    { return dark_col; }
  48.     const QColor &mid()        const    { return mid_col; }
  49.     const QColor &text()    const    { return text_col; }
  50.     const QColor &base()    const    { return base_col; }
  51.  
  52.     bool    operator==( const QColorGroup &g ) const;
  53.     bool    operator!=( const QColorGroup &g ) const
  54.                     { return !(operator==(g)); }
  55. private:
  56.     QColor fg_col;
  57.     QColor bg_col;
  58.     QColor light_col;
  59.     QColor dark_col;
  60.     QColor mid_col;
  61.     QColor text_col;
  62.     QColor base_col;
  63. };
  64.  
  65.  
  66. class QPalette                    // palette class
  67. {
  68. public:
  69.     QPalette();
  70.     QPalette( const QColor &background );
  71.     QPalette( const QColorGroup &normal, const QColorGroup &disabled,
  72.           const QColorGroup &active );
  73.     QPalette( const QPalette & );
  74.    ~QPalette();
  75.     QPalette &operator=( const QPalette & );
  76.  
  77.     QPalette    copy() const;
  78.  
  79.     const QColorGroup &normal()      const { return data->normal; }
  80.     const QColorGroup &disabled() const { return data->disabled; }
  81.     const QColorGroup &active()      const { return data->active; }
  82.  
  83.     void    setNormal( const QColorGroup & );
  84.     void    setDisabled( const QColorGroup & );
  85.     void    setActive( const QColorGroup & );
  86.  
  87.     bool    operator==( const QPalette &p ) const;
  88.     bool    operator!=( const QPalette &p ) const
  89.                     { return !(operator==(p)); }
  90.     bool    isCopyOf( const QPalette & );
  91.  
  92.     int        serialNumber() const    { return data->ser_no; }
  93.  
  94. private:
  95.     void    detach();
  96.  
  97.     struct QPalData : public QShared {
  98.     QColorGroup normal;
  99.     QColorGroup disabled;
  100.     QColorGroup active;
  101.     int        ser_no;
  102.     } *data;
  103. };
  104.  
  105.  
  106. /*****************************************************************************
  107.   QColorGroup/QPalette stream functions
  108.  *****************************************************************************/
  109.  
  110. QDataStream &operator<<( QDataStream &, const QColorGroup & );
  111. QDataStream &operator>>( QDataStream &, QColorGroup & );
  112.  
  113. QDataStream &operator<<( QDataStream &, const QPalette & );
  114. QDataStream &operator>>( QDataStream &, QPalette & );
  115.  
  116.  
  117. #endif // QPALETTE_H
  118.